﻿namespace PivotCollectionMaker.WinFormApplication
{
    using System;
    using System.Windows.Forms;

    public class CursorKeeper : IDisposable
    {
        private Cursor originalCursor;
        private bool isDisposed = false;

        public CursorKeeper(Cursor newCursor)
        {
            this.originalCursor = Cursor.Current;
            Cursor.Current = newCursor;
        }

        #region " IDisposable Support "

        protected virtual void Dispose(bool disposing)
        {
            if (!this.isDisposed)
            {
                if (disposing)
                {
                    Cursor.Current = this.originalCursor;
                }
            }

            this.isDisposed = true;
        }

        public void Dispose()
        {
            // Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        #endregion
    }

 

}
